package com.example.academicsystem.server.dao;

import com.example.academicsystem.pojo.dto.*;
import com.example.academicsystem.pojo.vo.AdminCourseVo;
import com.example.academicsystem.pojo.vo.GradeVo;
import com.example.academicsystem.pojo.vo.StudentVo;
import com.example.academicsystem.pojo.vo.TeacherVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface AdminMapper {
    /**
     * 分页查询学生信息
     * */
    Page<StudentVo> studentPageQuery(StudentDto studentDto);
    /**
     * 删除course_student by studentId
    * */
    @Delete("delete from student where student_id = #{studentId}")
    void courseStudentDeleteById(String studentId);
    /**
     * 删除student by id
     * */
    @Delete("delete from course_student where student_id = #{studentId}")
    void studentDelteById(String studentId);
    /**
     * 新增student
     * */
    boolean studentInsert(StudentInsertDto studentInsertDto);

    boolean studentUpdateById(StudentUpdateDto studentUpdateDto);

    Page<TeacherVo> teacherPageQuery(TeacherDto teacherDto);

    boolean teacherInsert(TeacherInsertDto teacherInsertDto);
    @Delete("delete from teacher where teacher_id=#{teacherId}")
    boolean teacherDeleteById(String teacherId);
    @Delete("delete from course_teacher where teacher_id =#{teacherId}")
    boolean courseTeacherDeleteById(String teacherId);

    void teacherUpdateById(TeacherUpdateDto teacherUpdateDto);

    Page<GradeVo> gradePageQuery(GradeDto gradeDto);

    void gradeInsert(GradeInsertDto gradeInsertDto);

    @Delete("delete from grade where student_id=#{studentId} and course_id=#{courseId}")
    void gradeDelete(GradeDeleteDto gradeDeleteDto);

    void gradeUpdate(GradeUpdateDto gradeUpdateDto);

    void courseInsert(CourseInsertDto courseInsertDto);

    void courseDelete(CourseDeleteDto courseDeleteDto);

    @Delete("delete from course_student where course_id = #{courseId}")
    void courseStudentDeleteByCourseId(CourseDeleteDto courseDeleteDto);

    @Delete("delete from course_teacher where course_id = #{courseId}")
    void courseTeacherDeleteByCourseId(CourseDeleteDto courseDeleteDto);

    Page<AdminCourseVo> coursePageQuery(AdminCourseDto adminCourseDto);

    void courseUpdate(CourseUpdateDto courseUpdateDto);
    @Insert("insert into class(class_id) values(#{id})")
    void classInsert(Integer id);
}
